import request from '@/utils/request'


// 分页查询所有采购需求
export function listpurchasedetail(params) {
  return request({
    url: '/ware/purchasedetail/list',
    method: 'GET',
    params: params
  })
}

// 新增或修改采购需求信息
export function addOrUpdatepurchasedetail(data) {
  if (!data.id){
    return request({
      url: '/ware/purchasedetail/save',
      method: 'POST',
      data: data
    })
  }else {
    return request({
      url: '/ware/purchasedetail/update',
      method: 'POST',
      data: data
    })
  }
}


// 修改采购需求信息
export function updatepurchasedetail(data) {
  return request({
    url: '/ware/purchasedetail/update',
    method: 'POST',
    data: data
  })
}

// 新增采购需求信息
export function addpurchasedetail(data) {
  return request({
    url: '/ware/purchasedetail/save',
    method: 'POST',
    data: data
  })
}

// 批量修改采购需求信息
export function updatepurchasedetailBatch(data) {
  return request({
    url: '/ware/purchasedetail/update/sort',
    method: 'POST',
    data: data
  })
}


// 查询采购需求信息
export function getpurchasedetailById(id) {
  return request({
    url: '/ware/purchasedetail/info/'+id,
    method: 'GET'
  })
}


// 批量删除采购需求信息
export function delpurchasedetailByIds(ids) {
  return request({
    url: '/ware/purchasedetail/delete',
    method: 'delete',
    data: ids
  })
}
